<template>
  <div class="box">
    <el-button type="primary" style="margin-left: 16px" @click="drawer = true">
      新增账号
    </el-button>

    <el-drawer v-model="drawer" title="I am the title" :with-header="false">
      <DrawerAcc :roleList="roleList" :drawer="true" />
    </el-drawer>
    <div>
      <AccTable />
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted, reactive } from 'vue'
import DrawerAcc from './components/DrawerAcc.vue'
import AccTable from './components/AccTable.vue'
import { getRoleList } from '@/api/role'

interface RoleType {
  name: string
  objectId: string
}

let roleList = reactive<Array<RoleType>>([])
// 将roleList注入
// provide("RoleList", roleList)

onMounted(() => {
  // getRole()
  getRoleList().then((res) => {
    roleList = res.data.results
    console.log('角色', roleList)
  })
})
const drawer = ref(false)
</script>

<style scoped lang="scss"></style>
